
using System;
using Mono.Data.SqliteClient;

namespace finlasku
{
	
	
	public abstract class AbstractSQLiteDao
	{
		private SQLiteConnectionManager _connectionManager = null;
		
		public AbstractSQLiteDao()
		{
		}
		
		public SQLiteConnectionManager ConnectionManager
		{
			get { return _connectionManager; }
			set { _connectionManager = value; }
		}
		
		protected SqliteConnection OpenConnection()
		{
			if (_connectionManager == null)
				throw new Exception("Failed to create database connection. Connection manager is not defined.");
			
			return _connectionManager.OpenConnection();
		}
	}
}
